package ar.edu.unlam.tpfinal.persistence.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import ar.edu.unlam.tpfinal.model.PersistentObject;
import ar.edu.unlam.tpfinal.persistence.exceptions.PersistenceExceptionWrapper;

public interface PersistentObjectDAO<T extends PersistentObject> {
	
	public void save(T abstractPersistentObject) 
			throws PersistenceExceptionWrapper;
	
	public void saveAll(List<T> abstractPersistentObjectList) 
			throws PersistenceExceptionWrapper;
	
	public void delete(T abstractPersistentObject) 
			throws PersistenceExceptionWrapper;
	
	public void deleteAll(List<T> abstractPersistentObjectList) 
			throws PersistenceExceptionWrapper;

	public T findByOID(Long oid) 
			throws PersistenceExceptionWrapper;

	public List<T> findAll() 
			throws PersistenceExceptionWrapper;

	public List<T> getObjectsByProperty(String propertyName, Object propertyValue) 
			throws PersistenceExceptionWrapper;
	
	public List<T> getObjectsByProperties(String[] propertyNames, Object[] propertyValues) 
			throws PersistenceExceptionWrapper;

	public T getUniqueObjectByProperty(String propertyName, Object propertyValue) 
			throws PersistenceExceptionWrapper;
	
	public T getUniqueObjectByProperties(String[] propertyNames, Object[] propertyValues) 
			throws PersistenceExceptionWrapper;
	
	public List<T> getByCriteria(DetachedCriteria criteria) 
			throws PersistenceExceptionWrapper;

	public List<T> getByCriteria(DetachedCriteria criteria, int amountOfRecords) 
			throws PersistenceExceptionWrapper;
}
